package com.gzy.xuexiziliao.mapper;

import com.gzy.xuexiziliao.pojo.entity.Doctor;
import com.gzy.xuexiziliao.pojo.entity.Information;
import com.gzy.xuexiziliao.pojo.entity.Categories;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface InformationCategoriesMapper {
    @Insert("insert into categories( category_name, create_time, update_time,status) " +
            "values(#{categoryName},#{createTime},#{updateTime},#{status})")
    void save(Categories categories);

    @Select("select * from categories where category_id = #{categoryId}")
    List<Information>   getBycategoryId(int informationId);
    void delete(List<Integer> ids);

    void update(Categories categories);

    @Select("select * from categories where category_id = #{id}")
    Categories getById(Integer id);

    List<Categories> list(String name, Short gender, LocalDate begin, LocalDate end);

    @Update("update information set category_id = #{categoryId} where information_id = #{informationId}")
    void updateByInformationId(int informationId, int categoryId);

    @Select("select category_name from categories where category_id = #{categoryId}")
    String getcategoryName(int categoryId);

    @Select("select status from categories where category_id = #{categoryId}")
    int getstatusById(int categoryId);

    @Select("select * from doctor where status = #{id}")
    List<Doctor> getstatus(Integer id);
}
